<?php /*a:1:{s:63:"D:\xinwujia\xshop\application\admin\view\hotel\index\index.html";i:1533290314;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>幻灯片</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <script src="/lib/jquery/1.9.1/jquery.js"></script>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script src="/H-ui.admin/lib/layer/2.4/layer.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div class="container-fluid" style="margin: 20px 50px">
    <div class="col-md-4">
        <div class="btn-group">
            <a class="btn btn-primary" href="<?php echo url('edit'); ?>">
                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                添加</a>
        </div>
    </div>
    <form class="col-md-8"action="<?php echo url('search'); ?>" method="post">
        <div class="col-md-12" style="float:right">
            <div class=" col-sm-9">
                <div class="input-group">
                    <span class="input-group-addon">关键字(电话或村名称)</span>
                    <input type="text" class="form-control" id="exampleInputEmail2" name="content" placeholder="">
                </div>
            </div>
            <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>搜索</button>
        </div>
    </form>

</div>


<div style="margin: 10px 50px">
<table class="table table-hover" style="width:100%">
    <tr>
        <th>ID</th>
        <th>农居名称</th>
        <th>农居图片</th>
        <th>农居类别</th>
        <th>农居价格</th>
        <th>长租定金</th>
        <th>短租日租价</th>
        <th>是否有宽带</th>
        <th>是否有热水</th>
        <th>是否通天然气</th>
        <th>创建时间</th>
        <th>操作</th>
    </tr>
    <?php foreach($items as $value): ?>
    <tr>
        <td><?php echo htmlentities($value['id']); ?></td>
        <td><?php echo htmlentities($value['name']); ?></td>
        <td>
            <img src="<?php echo htmlentities($value['cover']); ?>" class="img-responsive img-thumbnail" style="width: 100px"/>
        </td>
        <td><?php echo htmlentities($value['type']); ?></td>
        <td><?php echo htmlentities($value['price']); ?></td>
        <td><?php echo htmlentities($value['long_price']); ?></td>
        <td><?php echo htmlentities($value['short_price']); ?></td>
        <td>
            <strong>有</strong>

            <strong>没有</strong>
        </td>
        <td>

            <strong>有</strong>

            <strong>没有</strong>
        </td>
        <td>
            <strong>通</strong>

            <strong>没通</strong>
        </td>
        <td><?php echo htmlentities($value['createtime']); ?></td>
        <td>
            <a href="<?php echo url('edit'); ?>?id=<?php echo htmlentities($value['id']); ?>" class="btn btn-primary btn-xs">编辑</a>
            <a href="javescript:;" onclick="del(<?php echo htmlentities($value['id']); ?>)" class="btn btn-primary btn-xs">删除</a>
            <?php if(!$value['is_push']): ?>
            <a href="javescript:;" onclick="pullOrPush(<?php echo htmlentities($value['id']); ?>,1)" class="btn btn-primary btn-xs">上架</a>
            <?php else: ?>
            <a href="javescript:;" onclick="pullOrPush(<?php echo htmlentities($value['id']); ?>,0)" class="btn btn-primary btn-xs">下架</a>
            <?php endif; ?>
        </td>
    </tr>
    <?php endforeach; ?>
</table>
    <div style=""><?php echo $page ?></div>
</div>


</body>
<script>
    function del(id){
        layer.confirm('是否删除？', {
            btn: ['确认','否'] //按钮
        }, function(){
            $.ajax({
                url:"<?php echo url('del'); ?>?id="+id,
                type:"get",
                success:function (res) {
                    if(res.code==200){
                        layer.msg('删除成功', {icon: 1});
                        self.location.reload();
                    }
                }
            });

        }, function(){

        });
    }

    function pullOrPush(id,is_push) {
        if(is_push==0){
            var text='是否下架？';
            var btn="确认";
        }else {
            var text='是否上架？';
            var btn="确认";
        }

        layer.confirm(text, {
            btn: [btn,'否'] //按钮
        }, function(){
            $.ajax({
                url:"<?php echo url('pullOrPush'); ?>?id="+id+"&is_push="+is_push,
                type:"get",
                success:function (res) {
                    if(res.code==200){
                        layer.msg('下架成功', {icon: 1});
                        self.location.reload();
                    }
                }
            });

        }, function(){

        });
    }

</script>
</html>